package ca.athabascau.quizmaster.data;

public class Answer implements Comparable<Answer> {
private Question question;
private int answerNo;
private String answerText;
private String answerId;



public Answer(Question question, int answerNo, String answerText,
		String answerId) {
	super();
	this.question = question;
	this.answerNo = answerNo;
	this.answerText = answerText;
	this.answerId = answerId;
}
public Question getQuestion() {
	return question;
}
public void setQuestion(Question question) {
	this.question = question;
}
public int getAnswerNo() {
	return answerNo;
}
public void setAnswerNo(int answerNo) {
	this.answerNo = answerNo;
}
public String getAnswerText() {
	return answerText;
}
public void setAnswerText(String answerText) {
	this.answerText = answerText;
}
public String getAnswerId() {
	return answerId;
}
public void setAnswerId(String answerId) {
	this.answerId = answerId;
}
public int compareTo(Answer arg0) {
	// TODO Auto-generated method stub
	String[] comparedAnswer=arg0.answerId.split(",");
	String[] thisAnswer=this.getAnswerId().split(",");
	if (Integer.parseInt(comparedAnswer[0]) > Integer.parseInt(thisAnswer[0]))
	{
		return -1;
	}
	else
	{
		if(Integer.parseInt(comparedAnswer[0]) < Integer.parseInt(thisAnswer[0]))
		{
			return 1;
		}
		else
		{
			return 0;
		}
	}
	
}

}
